package com.imooc.enums;

public enum BaseEnum implements CommonEnum {
    /**成功*/
    OK(200, "成功"),
    // 通用错误类型100001
    /**参数不合法*/
    PARAMETER_VALIDATION_ERROR(100001, "参数不合法"),
    /**未知错误*/
    UNKNOWN_ERROR(100002, "未知错误"),
    // 2000开头为用户信息相关错误定义
    /**用户不存在*/
    USER_NOT_EXIST(20001, "用户不存在"),
    /**用户未登录*/
    USER_NOT_LOGIN(20003, "用户未登录"),
    /**用户手机号或密码不正确*/
    USER_LOGIN_FAIL(20002, "用户手机号或密码不正确"),
    /**请勿重复提交*/
    NO_REPEAT_SUBMIT(20004, "请勿重复提交"),
    /**库存不足*/
    STOCK_NOT_ENOUGH(30001, "库存不足")
    ;

    private int code;
    private String msg;

    private BaseEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public CommonEnum setMsg(String errMsg) {
        this.msg = errMsg;
        return this;
    }
}
